The raw color samples produced by a digital camera sensor are typically arranged into a so-called Bayer pattern. In the Bayer pattern, red, green, and blue samples are organized such that each 2×2 pixel tile contains two samples of green (G), one of red (R), and one of blue (B), where the green samples locate diagonally to each other in the 2×2 pixel tile.
The Bayer pattern has proven to be efficient for image acquisition, but rather inefficient for processing image data, particularly on a GPU (Graphics Processing Unit). This is because consecutive samples of the same color are not adjacent to each other in the vertical and horizontal directions.
On a typical GPU, accessing any one pixel of an image will cause an entire M×N pixel region to be fetched into the texture cache. If an arbitrary image processing algorithm needs to access samples of a certain color only, for example red (R) samples only, also the irrelevant two green (G) samples and the blue (B) sample would be stored in the cache along with each red sample. In other words, 75% of the expensive texture cache and memory bus bandwidth would be wasted. Thus, there is a need for a more efficient method for processing raw color samples.